<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 222px;
            background-color: pink;
        }

        .nav {
            width: 500px;
            height: 677px;
            margin: 80px;
        }

        .box {
            background-color: aquamarine;
        }
    </style>
</head>

<body>
    <div class="nav"></div>
    <script>
        const div = document.querySelector('div')
        // div.className = 'box'
        div.className = 'nav box'//意思就是保留了nav的style 也增加了box的style

    </script>
</body>

</html>